cmake_minimum_required(VERSION 3.13)
project(libxfce4ui)

set(LIBXFCE4UI_VERSION_API 2)


include(cmake/my_utils.cmake)
include(cmake/my_glib_utils.cmake)

set(IS_ALONE_COMPILE TRUE)
if (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
        set(IS_ALONE_COMPILE FALSE)
endif()

add_definitions(-DLIBXFCE4UI_COMPILATION)
add_definitions(-DHAVE_LIBSM)
find_package(PkgConfig)
if (${IS_ALONE_COMPILE})
pkg_check_modules(GLIB IMPORTED_TARGET glib-2.0)
pkg_check_modules(GIO IMPORTED_TARGET gio-2.0)
pkg_check_modules(GIO_UNIX IMPORTED_TARGET gio-unix-2.0)
pkg_check_modules(GMODULE IMPORTED_TARGET gmodule-2.0)
pkg_check_modules(GTHREAD IMPORTED_TARGET gthread-2.0)
pkg_check_modules(GTK IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GDK IMPORTED_TARGET gdk-3.0)
pkg_check_modules(XFCONF IMPORTED_TARGET libxfconf-0)
endif()
# pkg_check_modules(XCOMPOSITE IMPORTED_TARGET xcomposite)
# pkg_check_modules(EPOXY IMPORTED_TARGET epoxy)
pkg_check_modules(X11 IMPORTED_TARGET x11)
pkg_check_modules(STARTUP_NOTIFICATION IMPORTED_TARGET libstartup-notification-1.0)
# pkg_check_modules(XFCE4_KBD_PRIVATE IMPORTED_TARGET libxfce4kbd-private-3)
pkg_check_modules(XFCE4_UTIL IMPORTED_TARGET libxfce4util-1.0)
# pkg_check_modules(XPRESENT IMPORTED_TARGET xpresent)
# pkg_check_modules(XRENDER IMPORTED_TARGET xrender)
# pkg_check_modules(XINERAMA IMPORTED_TARGET xinerama)
# pkg_check_modules(XEXT IMPORTED_TARGET xext)
# pkg_check_modules(WNCK IMPORTED_TARGET libwnck-3.0)
# pkg_check_modules(POLKIT_GOBJECT IMPORTED_TARGET polkit-gobject-1)
pkg_check_modules(SM IMPORTED_TARGET sm)
# pkg_check_modules(ICE IMPORTED_TARGET ice)

my_check_header_exists_and_define_macro("sys/types.h")
my_check_header_exists_and_define_macro("sys/wait.h")
my_check_header_exists_and_define_macro("sys/stat.h")
my_check_header_exists_and_define_macro("errno.h")
my_check_header_exists_and_define_macro("fcntl.h")
my_check_header_exists_and_define_macro("memory.h")
my_check_header_exists_and_define_macro("signal.h")
my_check_header_exists_and_define_macro("stdlib.h")
my_check_header_exists_and_define_macro("string.h")
my_check_header_exists_and_define_macro("unistd.h")
my_check_header_exists_and_define_macro("grp.h")
my_check_header_exists_and_define_macro("stdarg.h")
my_check_header_exists_and_define_macro("locale.h")
my_check_function_exists_and_define_macro(gethostname HAVE_GETHOSTNAME)

add_library(libxfce4ui-macros-interface INTERFACE)
target_compile_definitions(libxfce4ui-macros-interface
        INTERFACE
        SN_API_NOT_YET_FROZEN
        GETTEXT_PACKAGE="libxfce4ui"
        PACKAGE_LOCALE_DIR="${CMAKE_INSTALL_PREFIX}/share/locale"
        DATADIR="${CMAKE_INSTALL_PREFIX}/share/xfce4"
        G_LOG_DOMAIN="libxfce4ui"
        LIBEXECDIR="libexecdir"
        LIBXFCE4UI_VERSION_API="${LIBXFCE4UI_VERSION_API}"
        PACKAGE_NAME="${PROJECT_NAME}"
        MANUAL_WEBSITE="https://docs.xfce.org/help.php"
        GETTEXT_PACKAGE="${PROJECT_NAME}"
)

add_subdirectory(libxfce4ui)
add_subdirectory(libxfce4kbd-private)
# add_subdirectory(xfce4-about)
# add_subdirectory(glade)
        # icons \
        # docs \
        # po \
        # tests
#
#distuninstallcheck_listfiles = \
#	find . -type f -print | grep -v ./share/icons/hicolor/icon-theme.cache
#
#distclean-local:
#	rm -rf *.cache *~
#
#.PHONY: ChangeLog
#
#ChangeLog: Makefile
#	(GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp \
#	&& mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) \
#	|| (touch ChangeLog; echo 'Git directory not found: installing possibly empty changelog.' >&2)
#
#dist-hook: ChangeLog
#
#EXTRA_DIST = \
#	README.md \
#	intltool-extract.in \
#	intltool-merge.in \
#	intltool-update.in \
#	m4/introspection.m4 \
#	m4/vapigen.m4
#
#DISTCLEANFILES = \
#	intltool-extract \
#	intltool-merge \
#	intltool-update \
#	po/.intltool-merge-cache.lock
#
#DISTCHECK_CONFIGURE_FLAGS = \
#	--enable-gtk-doc \
#	--disable-gladeui2 \
#	--enable-introspection \
#	--disable-vala
#
## vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
